Dynomotion

Group: DynoMotion Message: 9607 From: Tapio Larikka Date: 6/3/2014
Subject: Revisiting Mach3 Lathe threading? (again)
Attachments :

Hi Tom,
 
I've been busy with other things so this thread cutting issue has been aside.
 
I started the thread cutting last week and so far this freeze has come up once/day or once/600 workcycles.
Before this threading work I drilled some 4000 holes without any problem.
Each threaded nipple also has a relief/smaller diameter in it that is turned in 4 passes.
Thread is cut in 5 passes.
The freeze only appears at the beginning of threading pass/G32 move, as if waiting for the index.
 
I'll attach a txt file with 3 separate data instances from "Showthreadingvalues2.c".
 
Rgds,
 
Tapio
 
 
----- Original Message -----
Sent: Tuesday, February 18, 2014 10:05 PM
Subject: Re: [DynoMotion] Mach3 Lathe threading? (again)

 

Hi Tapio,

Thanks.  Those reports helped find a potential flaw in the order that things are setup for Threading in KFLOP.  If an interrupt occurred in the middle of setting things up it could potentially result in a hang.  The "window" of time where an interrupt might cause a problem is probably around 500ns.  Since interrupts occur every 90us that would be on the order of 1 in 200 chance of a hang that you are seeing.

Here is a link to new KFLOP Firmware.  It should be used with Test Version 4.31s.  Copy to the DSP_KFLOP directory then Flash New Version from KMotion.exe.

http://dynomotion.com/Software/Patch/FixThreadingHang4.31s/DSPKFLOP.out

Please let us know if it resolves the issue.

Regards
TK



Group: DynoMotion Message: 9620 From: Tom Kerekes Date: 6/5/2014
Subject: Re: Revisiting Mach3 Lathe threading? (again) [1 Attachment]
Hi Tapio,

Sorry for the delay.  I think we found something.   I believe it is the same problem as we thought we fixed before but didn't.  Depending on how interrupt timing there is still a chance the interrupt can start the threading before it is completely set up. 

I don't know if you are interested in the details but it turns out to be a very subtle and interesting C Programming issue.  In the C language there is no way (that I'm aware of) that you can dictate what order operations are actually performed.  The compiler is free to do it however it wishes as long as the final result is "as if" the code was executed in logical sequence.  Because this DSP has parallel functional units (8) and pipe-lining (5 levels) the machine code can be very complicated having up to 40 instructions in progress every 5ns CPU Cycle.   The TI Compiler does some crazy things to optimize the number of cycles to complete a specified task.  (BTW the TCC67 compiler normally used for User Programs has no real optimizations so it always does things in the order specified).  I've attached a printout of the code that has the issue and the generated assembly code.   I highlighted two critical operations with colors yellow and cyan.  You can see the order in C code and Assembly code has been reversed opening a 30ns window for a problem.   I also listed a some workarounds I tried and what I think we will use for the final solution.  I'd be interested to hear any other possible solutions.  Turning off interrupts is a common approach but we would like to avoid that if possible.

Hopefully we will have a patch for you to try soon.  Thanks for your patience.

Regards
TK




Group: DynoMotion Message: 9621 From: Tapio Larikka Date: 6/5/2014
Subject: Re: Revisiting Mach3 Lathe threading? (again) [1 Attachment]

Hi Tom,
 
Don't worry about time, I'm not in such rush with this. The patch and fix in 4.31 helped me so that this is only a once a day nuisance as compared to
prior limping. Keeps me from using bar feeder/unmanned machine, though :(
 
Interested in details yes, but understanding them so that I could offer some toughts/input is far beyond my skillset.
I'm more of a copy/paste-programmer, that's why I love .net and internet.
 
When you get so far that you have something to test, I'll be happy to do so. 
I suppose there is not very many who use Mach/Kflop setup to cut threads in this volume.
 
Is this timing issue also present with KMotionCNC or is it just a Mach/Plug-in related?
 
Aside from the main issue:
Have you ever considered the possibility of a screen designer for KMotionCNC?  (something like the ones with mach3)
 
Rgds,
Tapio
 
 
----- Original Message -----
Sent: Thursday, June 05, 2014 8:07 PM
Subject: Re: [DynoMotion] Revisiting Mach3 Lathe threading? (again) [1 Attachment]

 

Hi Tapio,

Sorry for the delay.  I think we found something.   I believe it is the same problem as we thought we fixed before but didn't.  Depending on how interrupt timing there is still a chance the interrupt can start the threading before it is completely set up. 

I don't know if you are interested in the details but it turns out to be a very subtle and interesting C Programming issue.  In the C language there is no way (that I'm aware of) that you can dictate what order operations are actually performed.  The compiler is free to do it however it wishes as long as the final result is "as if" the code was executed in logical sequence.  Because this DSP has parallel functional units (8) and pipe-lining (5 levels) the machine code can be very complicated having up to 40 instructions in progress every 5ns CPU Cycle.   The TI Compiler does some crazy things to optimize the number of cycles to complete a specified task.  (BTW the TCC67 compiler normally used for User Programs has no real optimizations so it always does things in the order specified).  I've attached a printout of the code that has the issue and the generated assembly code.   I highlighted two critical operations with colors yellow and cyan.  You can see the order in C code and Assembly code has been reversed opening a 30ns window for a problem.   I also listed a some workarounds I tried and what I think we will use for the final solution.  I'd be interested to hear any other possible solutions.  Turning off interrupts is a common approach but we would like to avoid that if possible.

Hopefully we will have a patch for you to try soon.  Thanks for your patience.

Regards
TK




Group: DynoMotion Message: 9635 From: Tom Kerekes Date: 6/7/2014
Subject: Re: Revisiting Mach3 Lathe threading? (again)
Hi Tapio,

Here is a KFLOP Firmware patch to try.  It should be compatible with V4.31 or V4.32

http://dynomotion.com/Software/Patch/FixMach3ThreadingHangV431V432/DSPKFLOP.out

Copy to the DSP_KFLOP directory and Flash New Version.

The the issue is in the way KFLOP Triggers the Threading and would be common to KMotionCNC also.

We are looking into ways to do a screen designer, but it will be a big job.  No promises if or when it will be ready.

Regards
TK

Group: DynoMotion Message: 9637 From: Tapio Larikka Date: 6/8/2014
Subject: Re: Revisiting Mach3 Lathe threading? (again)

Hi Tom,
 
Thank you for the patch, that was fast. I'll flash it tomorrow morning when I start the threading. By wednesday we should know if there is any more freezes.
 
It's great to hear that you are looking into the screen designer.
There's only two items on my wishlist, one beeing the screen design and other is machine profiles like in mach.
 
the profiles let me have a mill and lathe in same physical set up, switching by closing mach and restarting from next icon :)
 
Rgds
Tapio
 
 
----- Original Message -----
Sent: Sunday, June 08, 2014 3:59 AM
Subject: Re: [DynoMotion] Revisiting Mach3 Lathe threading? (again)

 

Hi Tapio,

Here is a KFLOP Firmware patch to try.  It should be compatible with V4.31 or V4.32


Copy to the DSP_KFLOP directory and Flash New Version.

The the issue is in the way KFLOP Triggers the Threading and would be common to KMotionCNC also.

We are looking into ways to do a screen designer, but it will be a big job.  No promises if or when it will be ready.

Regards
TK

Group: DynoMotion Message: 9638 From: tmday7 Date: 6/8/2014
Subject: Re: Revisiting Mach3 Lathe threading? (again)
Thats on wishlist also :)
Troy
Group: DynoMotion Message: 9667 From: janbbeck Date: 6/20/2014
Subject: Re: Revisiting Mach3 Lathe threading? (again) [1 Attachment]
That is very very interesting in deed. How did you solve the problem?


---In DynoMotion@yahoogroups.com, <tk@...> wrote :

Hi Tapio,

Sorry for the delay.  I think we found something.   I believe it is the same problem as we thought we fixed before but didn't.  Depending on how interrupt timing there is still a chance the interrupt can start the threading before it is completely set up. 

I don't know if you are interested in the details but it turns out to be a very subtle and interesting C Programming issue.  In the C language there is no way (that I'm aware of) that you can dictate what order operations are actually performed.  The compiler is free to do it however it wishes as long as the final result is "as if" the code was executed in logical sequence.  Because this DSP has parallel functional units (8) and pipe-lining (5 levels) the machine code can be very complicated having up to 40 instructions in progress every 5ns CPU Cycle.   The TI Compiler does some crazy things to optimize the number of cycles to complete a specified task.  (BTW the TCC67 compiler normally used for User Programs has no real optimizations so it always does things in the order specified).  I've attached a printout of the code that has the issue and the generated assembly code.   I highlighted two critical operations with colors yellow and cyan.  You can see the order in C code and Assembly code has been reversed opening a 30ns window for a problem.   I also listed a some workarounds I tried and what I think we will use for the final solution.  I'd be interested to hear any other possible solutions.  Turning off interrupts is a common approach but we would like to avoid that if possible.

Hopefully we will have a patch for you to try soon.  Thanks for your patience.

Regards
TK




Group: DynoMotion Message: 9668 From: Tom Kerekes Date: 6/20/2014
Subject: Re: Revisiting Mach3 Lathe threading? (again)
We haven't heard back from Tapio.  I'm hoping no news is good news :}

The patch that we are testing is described on the last page of the pdf file attached to the previous posts.  We added a WaitNextTimeSlice() at the beginning of the routine (and we examined the assembly code to verify the wait was made at the beginning of the routine - although also actually in-lined).  This guarantees that no interrupt will occur while the parameters are being set up.  Since no interrupt can occur the exact order of operations should not matter.

Regards
TK

Group: DynoMotion Message: 9734 From: tapiolarikka Date: 6/29/2014
Subject: Revisiting Mach3 Lathe threading? (again)
Hi Tom,
 
Yes, I got some 4 days of constant threading without errors before production schedule forced me to change setup.
It again appears that this is now solved, I'll report
back after next production run!
 
I hope I'm not jinxing this :)
 
Tapio